﻿using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using DevExpress.Utils;
using DevExpress.XtraEditors;
using DevExpress.XtraEditors.Controls;
using Dictionary.ERP;
using Common;
using Microsoft.VisualBasic;
using DevExpress.XtraEditors.Mask;
using Extra.ERP;
using Common.Class;
using Security.ERP;
using APP.HELPER.Utils;

namespace Dictionary
{
    public class xucShiftAdd : xucBaseAdd
    {
        public delegate void SuccessEventHander(object sender, DIC_SHIFT item);

        private readonly IContainer components = null;

        private CalcEdit calDistanceMinuteAOT;
        private CalcEdit calDistanceMinuteBOT;
        private CalcEdit calEarlyMinute;
        private CalcEdit calHalfWorkMinute;
        private CalcEdit calLateMinute;
        private CalcEdit calMaximumMinuteAOT;
        private CalcEdit calMaximumMinuteBOT;
        private CalcEdit calMinimumMinuteAOT;
        private CalcEdit calMinimumMinuteBOT;
        private CalcEdit calTotalHour;
        private CalcEdit calTotalMinute;
        private CalcEdit calWorkMinute;
        private ComboBoxEdit cboMethodCheck;
        private TextEdit cboWorkDay;
        private CheckEdit cheIsAOT;
        private CheckEdit cheIsBOT;
        private CheckEdit cheIsBreak;
        private CheckEdit cheIsBreakOvernight;
        private CheckEdit cheIsNightDutyDay;
        private CheckEdit cheIsOvernight;
        private GroupBox gbAOT;
        private GroupBox gbBOT;
        private GroupBox groupBox1;
        private GroupBox groupBox2;
        private GroupBox groupBox3;
        private GroupBox groupBox4;
        private GroupBox groupBox5;
        private LabelControl labelControl1;
        private LabelControl labelControl10;
        private LabelControl labelControl11;
        private LabelControl labelControl12;
        private LabelControl labelControl13;
        private LabelControl labelControl14;
        private LabelControl labelControl15;
        private LabelControl labelControl16;
        private LabelControl labelControl17;
        private LabelControl labelControl18;
        private LabelControl labelControl19;
        private LabelControl labelControl2;
        private LabelControl labelControl20;
        private LabelControl labelControl21;
        private LabelControl labelControl22;
        private LabelControl labelControl23;
        private LabelControl labelControl26;
        private LabelControl labelControl27;
        private LabelControl labelControl28;
        private LabelControl labelControl29;
        private LabelControl labelControl3;
        private LabelControl labelControl30;
        private LabelControl labelControl31;
        private LabelControl labelControl32;
        private LabelControl labelControl33;
        private LabelControl labelControl34;
        private LabelControl labelControl4;
        private LabelControl labelControl5;
        private LabelControl labelControl6;
        private LabelControl labelControl7;
        private LabelControl labelControl8;
        private LabelControl labelControl9;
        private LabelControl lbDistanceMinuteAOT;
        private LabelControl lbMaximumMinuteAOT;
        private LabelControl lbMinimumMinuteAOT;
        private TimeEdit teBeginTime;
        private TimeEdit teBeginTime1;
        private TimeEdit teBeginTime2;
        private TimeEdit teBreakBeginTime;
        private TimeEdit teBreakEndTime;
        private TimeEdit teEndTime;
        private TimeEdit teEndTime1;
        private TimeEdit teEndTime2;
        private MemoEdit txtDescription;

        public xucShiftAdd()
        {
            InitializeComponent();
        }

        public event SuccessEventHander Success;

        protected override void Add()
        {
            base.Add();
            base.txtID.Text = new DIC_SHIFT().NewID();
            base.txtNAME.Focus();
        }

        private void CalculatorMinute()
        {
            DateTime time = Convert.ToDateTime(teBeginTime.EditValue.ToString());
            DateTime dateValue = Convert.ToDateTime(teEndTime.EditValue.ToString());
            if (cheIsOvernight.Checked)
            {
                dateValue = DateAndTime.DateAdd(DateInterval.Day, 1.0, dateValue);
            }
            double num = MyDateTime.NumberHour(time, dateValue);
            int num2 = MyDateTime.NumberMinute(time, dateValue);
            if (cheIsBreak.Checked)
            {
                DateTime time3 = Convert.ToDateTime(teBreakBeginTime.EditValue.ToString());
                DateTime time4 = Convert.ToDateTime(teBreakEndTime.EditValue.ToString());
                if (cheIsBreakOvernight.Checked)
                {
                    time4 = DateAndTime.DateAdd(DateInterval.Day, 1.0, time3);
                }
                double num3 = MyDateTime.NumberHour(time3, time4);
                int num4 = MyDateTime.NumberMinute(time3, time4);
                num -= num3;
                num2 -= num4;
            }
            calTotalHour.EditValue = num;
            calTotalMinute.EditValue = num2;
        }

        private void cboMethodCheck_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cboMethodCheck.SelectedIndex == 0)
            {
                gbBOT.Enabled = true;
                gbAOT.Enabled = false;
            }
            else if (cboMethodCheck.SelectedIndex == 1)
            {
                gbBOT.Enabled = false;
                gbAOT.Enabled = true;
            }
            else
            {
                gbBOT.Enabled = true;
                gbAOT.Enabled = true;
            }
        }

        private void cheIsAOT_CheckedChanged(object sender, EventArgs e)
        {
            if (cheIsAOT.Checked)
            {
                calMinimumMinuteAOT.Enabled = true;
                calMaximumMinuteAOT.Enabled = true;
                calDistanceMinuteAOT.Enabled = true;
            }
            else
            {
                calMinimumMinuteAOT.Enabled = false;
                calMaximumMinuteAOT.Enabled = false;
                calDistanceMinuteAOT.Enabled = false;
            }
        }

        private void cheIsBOT_CheckedChanged(object sender, EventArgs e)
        {
            if (cheIsBOT.Checked)
            {
                calMinimumMinuteBOT.Enabled = true;
                calMaximumMinuteBOT.Enabled = true;
                calDistanceMinuteBOT.Enabled = true;
            }
            else
            {
                calMinimumMinuteBOT.Enabled = false;
                calMaximumMinuteBOT.Enabled = false;
                calDistanceMinuteBOT.Enabled = false;
            }
        }

        private void cheIsBreak_CheckedChanged(object sender, EventArgs e)
        {
            if (cheIsBreak.Checked)
            {
                cheIsBreakOvernight.Enabled = true;
                teBreakBeginTime.Enabled = true;
                teBreakEndTime.Enabled = true;
            }
            else
            {
                cheIsBreakOvernight.Enabled = false;
                teBreakBeginTime.Enabled = false;
                teBreakEndTime.Enabled = false;
            }
            CalculatorMinute();
        }

        private void cheIsBreakOvernight_CheckedChanged(object sender, EventArgs e)
        {
            CalculatorMinute();
        }

        private void cheIsNightDay_EditValueChanged(object sender, EventArgs e)
        {
            if (cheIsNightDutyDay.Checked)
            {
                var dic_shift = new DIC_SHIFT();
                if (dic_shift.ExistNightDay(base.txtID.Text))
                {
                    cheIsNightDutyDay.Checked = false;
                    XtraMessageBox.Show("Đ\x00e3 tồn tại ca trực đ\x00eam!", "Th\x00f4ng B\x00e1o", MessageBoxButtons.OK,
                        MessageBoxIcon.Asterisk);
                }
                else
                {
                    base.txtNAME.Text = "Trực đ\x00eam";
                    base.txtNAME.Enabled = false;
                    cheIsOvernight.Checked = true;
                    gbBOT.Enabled = false;
                    gbAOT.Text = "T\x00ednh tăng cường sau giờ trực đ\x00eam";
                    lbMinimumMinuteAOT.Text = "Đủ bao nhi\x00eau ph\x00fat t\x00ednh tăng cường?";
                    lbMaximumMinuteAOT.Text = "Số ph\x00fat tăng cường tối đa bao nhi\x00eau?";
                    lbDistanceMinuteAOT.Text = "C\x00e1ch giờ kết th\x00fac ca bao nhi\x00eau ph\x00fat?";
                }
            }
            else
            {
                base.txtNAME.Enabled = true;
                gbBOT.Enabled = true;
                gbAOT.Text = "T\x00ednh tăng ca sau giờ l\x00e0m việc";
                lbMinimumMinuteAOT.Text = "Đủ bao nhi\x00eau ph\x00fat th\x00ec t\x00ednh tăng ca?";
                lbMaximumMinuteAOT.Text = "Số ph\x00fat tăng ca tối đa l\x00e0 bao nhi\x00eau?";
                lbDistanceMinuteAOT.Text = "C\x00e1ch giờ kết th\x00fac ca bao nhi\x00eau ph\x00fat?";
            }
        }

        public void Clear()
        {
            base.txtID.Text = "";
            base.txtNAME.Text = "";
            txtDescription.Text = "";
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        protected override void Init()
        {
        }

        private void InitializeComponent()
        {
            var manager = new ComponentResourceManager(typeof (xucShiftAdd));
            teBeginTime = new TimeEdit();
            teEndTime = new TimeEdit();
            labelControl1 = new LabelControl();
            labelControl2 = new LabelControl();
            labelControl3 = new LabelControl();
            groupBox1 = new GroupBox();
            labelControl6 = new LabelControl();
            labelControl7 = new LabelControl();
            teEndTime2 = new TimeEdit();
            teEndTime1 = new TimeEdit();
            labelControl4 = new LabelControl();
            labelControl5 = new LabelControl();
            teBeginTime2 = new TimeEdit();
            teBeginTime1 = new TimeEdit();
            groupBox2 = new GroupBox();
            labelControl11 = new LabelControl();
            labelControl10 = new LabelControl();
            calEarlyMinute = new CalcEdit();
            calLateMinute = new CalcEdit();
            labelControl9 = new LabelControl();
            labelControl8 = new LabelControl();
            cheIsOvernight = new CheckEdit();
            groupBox3 = new GroupBox();
            cheIsBreakOvernight = new CheckEdit();
            cheIsBreak = new CheckEdit();
            teBreakBeginTime = new TimeEdit();
            labelControl13 = new LabelControl();
            labelControl12 = new LabelControl();
            teBreakEndTime = new TimeEdit();
            groupBox4 = new GroupBox();
            labelControl23 = new LabelControl();
            labelControl22 = new LabelControl();
            labelControl15 = new LabelControl();
            labelControl16 = new LabelControl();
            calTotalHour = new CalcEdit();
            labelControl17 = new LabelControl();
            labelControl14 = new LabelControl();
            calTotalMinute = new CalcEdit();
            labelControl19 = new LabelControl();
            calWorkMinute = new CalcEdit();
            labelControl18 = new LabelControl();
            labelControl20 = new LabelControl();
            calHalfWorkMinute = new CalcEdit();
            labelControl21 = new LabelControl();
            txtDescription = new MemoEdit();
            groupBox5 = new GroupBox();
            cboMethodCheck = new ComboBoxEdit();
            gbAOT = new GroupBox();
            labelControl34 = new LabelControl();
            lbMaximumMinuteAOT = new LabelControl();
            calMaximumMinuteAOT = new CalcEdit();
            labelControl27 = new LabelControl();
            labelControl26 = new LabelControl();
            cheIsAOT = new CheckEdit();
            lbDistanceMinuteAOT = new LabelControl();
            calDistanceMinuteAOT = new CalcEdit();
            lbMinimumMinuteAOT = new LabelControl();
            calMinimumMinuteAOT = new CalcEdit();
            gbBOT = new GroupBox();
            labelControl32 = new LabelControl();
            labelControl33 = new LabelControl();
            calMaximumMinuteBOT = new CalcEdit();
            labelControl28 = new LabelControl();
            labelControl29 = new LabelControl();
            cheIsBOT = new CheckEdit();
            labelControl30 = new LabelControl();
            calDistanceMinuteBOT = new CalcEdit();
            labelControl31 = new LabelControl();
            calMinimumMinuteBOT = new CalcEdit();
            cheIsNightDutyDay = new CheckEdit();
            cboWorkDay = new TextEdit();
            base.gcInfo.BeginInit();
            base.gcInfo.SuspendLayout();
            base.txtNAME.Properties.BeginInit();
            base.txtID.Properties.BeginInit();
            base.imageCollection2.BeginInit();
            ((ISupportInitialize) base.Err).BeginInit();
            teBeginTime.Properties.BeginInit();
            teEndTime.Properties.BeginInit();
            groupBox1.SuspendLayout();
            teEndTime2.Properties.BeginInit();
            teEndTime1.Properties.BeginInit();
            teBeginTime2.Properties.BeginInit();
            teBeginTime1.Properties.BeginInit();
            groupBox2.SuspendLayout();
            calEarlyMinute.Properties.BeginInit();
            calLateMinute.Properties.BeginInit();
            cheIsOvernight.Properties.BeginInit();
            groupBox3.SuspendLayout();
            cheIsBreakOvernight.Properties.BeginInit();
            cheIsBreak.Properties.BeginInit();
            teBreakBeginTime.Properties.BeginInit();
            teBreakEndTime.Properties.BeginInit();
            groupBox4.SuspendLayout();
            calTotalHour.Properties.BeginInit();
            calTotalMinute.Properties.BeginInit();
            calWorkMinute.Properties.BeginInit();
            calHalfWorkMinute.Properties.BeginInit();
            txtDescription.Properties.BeginInit();
            groupBox5.SuspendLayout();
            cboMethodCheck.Properties.BeginInit();
            gbAOT.SuspendLayout();
            calMaximumMinuteAOT.Properties.BeginInit();
            cheIsAOT.Properties.BeginInit();
            calDistanceMinuteAOT.Properties.BeginInit();
            calMinimumMinuteAOT.Properties.BeginInit();
            gbBOT.SuspendLayout();
            calMaximumMinuteBOT.Properties.BeginInit();
            cheIsBOT.Properties.BeginInit();
            calDistanceMinuteBOT.Properties.BeginInit();
            calMinimumMinuteBOT.Properties.BeginInit();
            cheIsNightDutyDay.Properties.BeginInit();
            cboWorkDay.Properties.BeginInit();
            base.SuspendLayout();
            base.gcInfo.Controls.Add(gbBOT);
            base.gcInfo.Controls.Add(gbAOT);
            base.gcInfo.Controls.Add(groupBox5);
            base.gcInfo.Controls.Add(groupBox4);
            base.gcInfo.Controls.Add(groupBox3);
            base.gcInfo.Controls.Add(cheIsNightDutyDay);
            base.gcInfo.Controls.Add(cheIsOvernight);
            base.gcInfo.Controls.Add(groupBox2);
            base.gcInfo.Controls.Add(groupBox1);
            base.gcInfo.Controls.Add(labelControl3);
            base.gcInfo.Controls.Add(labelControl2);
            base.gcInfo.Controls.Add(labelControl1);
            base.gcInfo.Controls.Add(teEndTime);
            base.gcInfo.Controls.Add(teBeginTime);
            base.gcInfo.Controls.Add(txtDescription);
            base.gcInfo.Dock = DockStyle.Top;
            base.gcInfo.Location = new Point(0, 0);
            base.gcInfo.Size = new Size(640, 460);
            base.gcInfo.TabIndex = 1;
            base.gcInfo.Controls.SetChildIndex(txtDescription, 0);
            base.gcInfo.Controls.SetChildIndex(teBeginTime, 0);
            base.gcInfo.Controls.SetChildIndex(base.lblName, 0);
            base.gcInfo.Controls.SetChildIndex(base.lblId, 0);
            base.gcInfo.Controls.SetChildIndex(base.txtID, 0);
            base.gcInfo.Controls.SetChildIndex(base.txtNAME, 0);
            base.gcInfo.Controls.SetChildIndex(teEndTime, 0);
            base.gcInfo.Controls.SetChildIndex(labelControl1, 0);
            base.gcInfo.Controls.SetChildIndex(labelControl2, 0);
            base.gcInfo.Controls.SetChildIndex(labelControl3, 0);
            base.gcInfo.Controls.SetChildIndex(groupBox1, 0);
            base.gcInfo.Controls.SetChildIndex(groupBox2, 0);
            base.gcInfo.Controls.SetChildIndex(cheIsOvernight, 0);
            base.gcInfo.Controls.SetChildIndex(cheIsNightDutyDay, 0);
            base.gcInfo.Controls.SetChildIndex(groupBox3, 0);
            base.gcInfo.Controls.SetChildIndex(groupBox4, 0);
            base.gcInfo.Controls.SetChildIndex(groupBox5, 0);
            base.gcInfo.Controls.SetChildIndex(gbAOT, 0);
            base.gcInfo.Controls.SetChildIndex(gbBOT, 0);
            base.txtNAME.Location = new Point(0x41, 0x37);
            base.txtNAME.Size = new Size(0xff, 20);
            base.txtNAME.TabIndex = 4;
            base.lblName.Location = new Point(5, 0x3a);
            base.lblName.Size = new Size(0x24, 13);
            base.lblName.TabIndex = 3;
            base.lblName.Text = "T\x00ean ca:";
            base.txtID.Location = new Point(0x41, 0x1d);
            base.txtID.Size = new Size(0x5f, 20);
            base.lblId.Location = new Point(5, 0x20);
            base.lblId.Size = new Size(0x20, 14);
            base.lblId.Text = "M\x00e3 ca:";
            //base.imageCollection2.ImageStream =
            //    (ImageCollectionStreamer) manager.GetObject("imageCollection2.ImageStream");
            base.btnSave.Location = new Point(0x15b, 0x1da);
            base.btnSave.TabIndex = 2;
            base.btnCancel.Location = new Point(0x21a, 0x1da);
            base.btnCancel.TabIndex = 0;
            base.btnSaveNew.Location = new Point(0x1bd, 0x1da);
            base.btnSaveNew.TabIndex = 3;
            teBeginTime.EditValue = new DateTime(0x7db, 7, 30, 0, 0, 0, 0);
            teBeginTime.Location = new Point(0x41, 0x51);
            teBeginTime.Name = "teBeginTime";
            //teBeginTime.Properties.Buttons.AddRange(new[] {new EditorButton()});
            teBeginTime.Properties.Mask.EditMask = "HH:mm tt";
            teBeginTime.Size = new Size(0x5f, 20);
            teBeginTime.TabIndex = 6;
            teBeginTime.EditValueChanged += teBeginTime_EditValueChanged;
            teEndTime.EditValue = new DateTime(0x7db, 7, 30, 0, 0, 0, 0);
            teEndTime.Location = new Point(0xda, 0x51);
            teEndTime.Name = "teEndTime";
//            teEndTime.Properties.Buttons.AddRange(new[] {new EditorButton()});
            teEndTime.Properties.Mask.EditMask = "HH:mm tt";
            teEndTime.Size = new Size(0x66, 20);
            teEndTime.TabIndex = 8;
            teEndTime.EditValueChanged += teEndTime_EditValueChanged;
            labelControl1.Location = new Point(14, 0x1a8);
            labelControl1.Name = "labelControl1";
            labelControl1.Size = new Size(0x27, 13);
            labelControl1.TabIndex = 11;
            labelControl1.Text = "Ghi ch\x00fa:";
            labelControl2.AllowHtmlString = true;
            labelControl2.Location = new Point(7, 0x54);
            labelControl2.Name = "labelControl2";
            labelControl2.Size = new Size(0x39, 14);
            labelControl2.TabIndex = 5;
            labelControl2.Text = "Giờ v\x00e0o <color=red>(*)</color>:";
            labelControl3.AllowHtmlString = true;
            labelControl3.Location = new Point(0xa5, 0x54);
            labelControl3.Name = "labelControl3";
            labelControl3.Size = new Size(0x31, 14);
            labelControl3.TabIndex = 7;
            labelControl3.Text = "Giờ ra <color=red>(*)</color>:";
            groupBox1.Controls.Add(labelControl6);
            groupBox1.Controls.Add(labelControl7);
            groupBox1.Controls.Add(teEndTime2);
            groupBox1.Controls.Add(teEndTime1);
            groupBox1.Controls.Add(labelControl4);
            groupBox1.Controls.Add(labelControl5);
            groupBox1.Controls.Add(teBeginTime2);
            groupBox1.Controls.Add(teBeginTime1);
            groupBox1.Location = new Point(7, 0x6b);
            groupBox1.Name = "groupBox1";
            groupBox1.Size = new Size(0x138, 0x4e);
            groupBox1.TabIndex = 9;
            groupBox1.TabStop = false;
            groupBox1.Text = "Giờ x\x00e1c định ca (t\x00f9y chọn để duyệt tự động từ m\x00e1y chấm c\x00f4ng)";
            labelControl6.Location = new Point(0xb0, 0x37);
            labelControl6.Name = "labelControl6";
            labelControl6.Size = new Size(0x12, 13);
            labelControl6.TabIndex = 6;
            labelControl6.Text = "đến";
            labelControl7.Location = new Point(0x10, 0x37);
            labelControl7.Name = "labelControl7";
            labelControl7.Size = new Size(0x2a, 13);
            labelControl7.TabIndex = 4;
            labelControl7.Text = "Giờ ra từ";
            teEndTime2.EditValue = new DateTime(0x7db, 7, 30, 0, 0, 0, 0);
            teEndTime2.Location = new Point(0xd1, 0x34);
            teEndTime2.Name = "teEndTime2";
//            teEndTime2.Properties.Buttons.AddRange(new[] {new EditorButton()});
            teEndTime2.Properties.Mask.EditMask = "HH:mm tt";
            teEndTime2.Size = new Size(0x58, 20);
            teEndTime2.TabIndex = 7;
            teEndTime1.EditValue = new DateTime(0x7db, 7, 30, 0, 0, 0, 0);
            teEndTime1.Location = new Point(0x48, 0x34);
            teEndTime1.Name = "teEndTime1";
//            teEndTime1.Properties.Buttons.AddRange(new[] {new EditorButton()});
            teEndTime1.Properties.Mask.EditMask = "HH:mm tt";
            teEndTime1.Size = new Size(90, 20);
            teEndTime1.TabIndex = 5;
            labelControl4.Location = new Point(0xb0, 0x1d);
            labelControl4.Name = "labelControl4";
            labelControl4.Size = new Size(0x12, 13);
            labelControl4.TabIndex = 2;
            labelControl4.Text = "đến";
            labelControl5.Location = new Point(0x10, 0x1d);
            labelControl5.Name = "labelControl5";
            labelControl5.Size = new Size(50, 13);
            labelControl5.TabIndex = 0;
            labelControl5.Text = "Giờ v\x00e0o từ";
            teBeginTime2.EditValue = new DateTime(0x7db, 7, 30, 0, 0, 0, 0);
            teBeginTime2.Location = new Point(0xd1, 0x1a);
            teBeginTime2.Name = "teBeginTime2";
//            teBeginTime2.Properties.Buttons.AddRange(new[] {new EditorButton()});
            teBeginTime2.Properties.Mask.EditMask = "HH:mm tt";
            teBeginTime2.Size = new Size(0x58, 20);
            teBeginTime2.TabIndex = 3;
            teBeginTime1.EditValue = new DateTime(0x7db, 7, 30, 0, 0, 0, 0);
            teBeginTime1.Location = new Point(0x48, 0x1a);
            teBeginTime1.Name = "teBeginTime1";
//            teBeginTime1.Properties.Buttons.AddRange(new[] {new EditorButton()});
            teBeginTime1.Properties.Mask.EditMask = "HH:mm tt";
            teBeginTime1.Size = new Size(90, 20);
            teBeginTime1.TabIndex = 1;
            groupBox2.Controls.Add(labelControl11);
            groupBox2.Controls.Add(labelControl10);
            groupBox2.Controls.Add(calEarlyMinute);
            groupBox2.Controls.Add(calLateMinute);
            groupBox2.Controls.Add(labelControl9);
            groupBox2.Controls.Add(labelControl8);
            groupBox2.Location = new Point(5, 0xc1);
            groupBox2.Name = "groupBox2";
            groupBox2.Size = new Size(0x139, 0x43);
            groupBox2.TabIndex = 10;
            groupBox2.TabStop = false;
            groupBox2.Text =
                "Thời gian tối đa cho ph\x00e9p đi trể, về sớm (t\x00f9y chọn để duyệt tự động từ m\x00e1y chấm c\x00f4ng)";
            labelControl11.Appearance.ForeColor = Color.Blue;
            labelControl11.Appearance.Options.UseForeColor = true;
            labelControl11.Location = new Point(0x10f, 0x29);
            labelControl11.Name = "labelControl11";
            labelControl11.Size = new Size(30, 13);
            labelControl11.TabIndex = 5;
            labelControl11.Text = "(ph\x00fat)";
            labelControl10.Appearance.ForeColor = Color.Blue;
            labelControl10.Appearance.Options.UseForeColor = true;
            labelControl10.Location = new Point(0x7d, 40);
            labelControl10.Name = "labelControl10";
            labelControl10.Size = new Size(30, 13);
            labelControl10.TabIndex = 2;
            labelControl10.Text = "(ph\x00fat)";
            var bits = new int[4];
            calEarlyMinute.EditValue = new decimal(bits);
            calEarlyMinute.Location = new Point(0xce, 0x25);
            calEarlyMinute.Name = "calEarlyMinute";
//            calEarlyMinute.Properties.Buttons.AddRange(new[] {new EditorButton(ButtonPredefines.Combo)});
            calEarlyMinute.Size = new Size(0x3e, 20);
            calEarlyMinute.TabIndex = 4;
            bits = new int[4];
            calLateMinute.EditValue = new decimal(bits);
            calLateMinute.Location = new Point(0x34, 0x25);
            calLateMinute.Name = "calLateMinute";
//            calLateMinute.Properties.Buttons.AddRange(new[] {new EditorButton(ButtonPredefines.Combo)});
            calLateMinute.Size = new Size(70, 20);
            calLateMinute.TabIndex = 1;
            labelControl9.Location = new Point(0xa5, 40);
            labelControl9.Name = "labelControl9";
            labelControl9.Size = new Size(0x26, 13);
            labelControl9.TabIndex = 3;
            labelControl9.Text = "Về sớm:";
            labelControl8.Location = new Point(15, 0x27);
            labelControl8.Name = "labelControl8";
            labelControl8.Size = new Size(0x1f, 13);
            labelControl8.TabIndex = 0;
            labelControl8.Text = "Đi trể:";
            cheIsOvernight.Location = new Point(0xa4, 30);
            cheIsOvernight.Name = "cheIsOvernight";
            cheIsOvernight.Properties.Caption = "Ca sang đ\x00eam";
            cheIsOvernight.Size = new Size(0x57, 0x13);
            cheIsOvernight.TabIndex = 2;
            cheIsOvernight.EditValueChanged += cheIsBreakOvernight_CheckedChanged;
            groupBox3.Controls.Add(cheIsBreakOvernight);
            groupBox3.Controls.Add(cheIsBreak);
            groupBox3.Controls.Add(teBreakBeginTime);
            groupBox3.Controls.Add(labelControl13);
            groupBox3.Controls.Add(labelControl12);
            groupBox3.Controls.Add(teBreakEndTime);
            groupBox3.Location = new Point(7, 0x10a);
            groupBox3.Name = "groupBox3";
            groupBox3.Size = new Size(0x137, 0x4c);
            groupBox3.TabIndex = 13;
            groupBox3.TabStop = false;
            groupBox3.Text = "Giờ nghỉ giữa ca";
            cheIsBreakOvernight.Enabled = false;
            cheIsBreakOvernight.Location = new Point(0x77, 0x15);
            cheIsBreakOvernight.Name = "cheIsBreakOvernight";
            cheIsBreakOvernight.Properties.Caption = "Giờ nghỉ giữa ca c\x00f3 sang đ\x00eam";
            cheIsBreakOvernight.Size = new Size(0xa9, 0x13);
            cheIsBreakOvernight.TabIndex = 1;
            cheIsBreakOvernight.CheckedChanged += cheIsBreakOvernight_CheckedChanged;
            cheIsBreak.Location = new Point(6, 0x15);
            cheIsBreak.Name = "cheIsBreak";
            cheIsBreak.Properties.Caption = "C\x00f3 nghỉ giữa ca";
            cheIsBreak.Size = new Size(0x6b, 0x13);
            cheIsBreak.TabIndex = 0;
            cheIsBreak.CheckedChanged += cheIsBreak_CheckedChanged;
            teBreakBeginTime.EditValue = new DateTime(0x7db, 7, 30, 0, 0, 0, 0);
            teBreakBeginTime.Enabled = false;
            teBreakBeginTime.Location = new Point(0x4b, 0x2f);
            teBreakBeginTime.Name = "teBreakBeginTime";
//            teBreakBeginTime.Properties.Buttons.AddRange(new[] {new EditorButton()});
            teBreakBeginTime.Properties.Mask.EditMask = "HH:mm tt";
            teBreakBeginTime.Size = new Size(0x44, 20);
            teBreakBeginTime.TabIndex = 3;
            teBreakBeginTime.EditValueChanged += teBreakBeginTime_EditValueChanged;
            labelControl13.AllowHtmlString = true;
            labelControl13.Location = new Point(10, 50);
            labelControl13.Name = "labelControl13";
            labelControl13.Size = new Size(0x3b, 14);
            labelControl13.TabIndex = 2;
            labelControl13.Text = "Giờ bắt đầu:";
            labelControl12.AllowHtmlString = true;
            labelControl12.Location = new Point(0x99, 50);
            labelControl12.Name = "labelControl12";
            labelControl12.Size = new Size(0x3d, 14);
            labelControl12.TabIndex = 4;
            labelControl12.Text = "Giờ kết th\x00fac:";
            teBreakEndTime.EditValue = new DateTime(0x7db, 7, 30, 0, 0, 0, 0);
            teBreakEndTime.Enabled = false;
            teBreakEndTime.Location = new Point(0xda, 0x30);
            teBreakEndTime.Name = "teBreakEndTime";
//            teBreakEndTime.Properties.Buttons.AddRange(new[] {new EditorButton()});
            teBreakEndTime.Properties.Mask.EditMask = "HH:mm tt";
            teBreakEndTime.Size = new Size(0x44, 20);
            teBreakEndTime.TabIndex = 5;
            teBreakEndTime.EditValueChanged += teBreakBeginTime_EditValueChanged;
            groupBox4.Controls.Add(labelControl23);
            groupBox4.Controls.Add(labelControl22);
            groupBox4.Controls.Add(labelControl15);
            groupBox4.Controls.Add(labelControl16);
            groupBox4.Controls.Add(calTotalHour);
            groupBox4.Controls.Add(labelControl17);
            groupBox4.Controls.Add(labelControl14);
            groupBox4.Controls.Add(calTotalMinute);
            groupBox4.Controls.Add(cboWorkDay);
            groupBox4.Location = new Point(0x145, 0x10a);
            groupBox4.Name = "groupBox4";
            groupBox4.Size = new Size(0x133, 0x8d);
            groupBox4.TabIndex = 0;
            groupBox4.TabStop = false;
            groupBox4.Text = "C\x00e1c tham số kh\x00e1c";
            labelControl23.Appearance.ForeColor = Color.Blue;
            labelControl23.Appearance.Options.UseForeColor = true;
            labelControl23.Location = new Point(0x103, 0x5b);
            labelControl23.Name = "labelControl23";
            labelControl23.Size = new Size(0x20, 13);
            labelControl23.TabIndex = 14;
            labelControl23.Text = "(ng\x00e0y)";
            labelControl22.Location = new Point(12, 90);
            labelControl22.Name = "labelControl22";
            labelControl22.Size = new Size(0x9c, 13);
            labelControl22.TabIndex = 12;
            labelControl22.Text = "Số ng\x00e0y c\x00f4ng khi l\x00e0m việc đủ ca?";
            labelControl15.Location = new Point(12, 0x18);
            labelControl15.Name = "labelControl15";
            labelControl15.Size = new Size(0x98, 13);
            labelControl15.TabIndex = 0;
            labelControl15.Text = "Tổng số ph\x00fat trong ca l\x00e0m việc?";
            labelControl16.Appearance.ForeColor = Color.Blue;
            labelControl16.Appearance.Options.UseForeColor = true;
            labelControl16.Location = new Point(0x103, 0x35);
            labelControl16.Name = "labelControl16";
            labelControl16.Size = new Size(0x16, 13);
            labelControl16.TabIndex = 5;
            labelControl16.Text = "(giờ)";
            bits = new int[4];
            calTotalHour.EditValue = new decimal(bits);
            calTotalHour.Location = new Point(0xc1, 50);
            calTotalHour.Name = "calTotalHour";
//            calTotalHour.Properties.Buttons.AddRange(new[] {new EditorButton(ButtonPredefines.Combo)});
            calTotalHour.Properties.ReadOnly = true;
            calTotalHour.Size = new Size(0x3a, 20);
            calTotalHour.TabIndex = 4;
            labelControl17.Location = new Point(12, 0x35);
            labelControl17.Name = "labelControl17";
            labelControl17.Size = new Size(0x90, 13);
            labelControl17.TabIndex = 3;
            labelControl17.Text = "Tổng số giờ trong ca l\x00e0m việc?";
            labelControl14.Appearance.ForeColor = Color.Blue;
            labelControl14.Appearance.Options.UseForeColor = true;
            labelControl14.Location = new Point(0x103, 0x17);
            labelControl14.Name = "labelControl14";
            labelControl14.Size = new Size(30, 13);
            labelControl14.TabIndex = 2;
            labelControl14.Text = "(ph\x00fat)";
            bits = new int[4];
            calTotalMinute.EditValue = new decimal(bits);
            calTotalMinute.Location = new Point(0xc1, 0x15);
            calTotalMinute.Name = "calTotalMinute";
//            calTotalMinute.Properties.Buttons.AddRange(new[] {new EditorButton(ButtonPredefines.Combo)});
            calTotalMinute.Properties.ReadOnly = true;
            calTotalMinute.Size = new Size(0x3a, 20);
            calTotalMinute.TabIndex = 1;
            labelControl19.AllowHtmlString = true;
            labelControl19.Location = new Point(15, 0x1d4);
            labelControl19.Name = "labelControl19";
            labelControl19.Size = new Size(0x9f, 14);
            labelControl19.TabIndex = 6;
            labelControl19.Text = "Từ bao nhi\x00eau ph\x00fat th\x00ec đủ <color=red><b>1</b></color> c\x00f4ng?";
            labelControl19.Visible = false;
            bits = new int[4];
            bits[0] = 1;
            calWorkMinute.EditValue = new decimal(bits);
            calWorkMinute.Location = new Point(0xbd, 0x1d3);
            calWorkMinute.Name = "calWorkMinute";
//            calWorkMinute.Properties.Buttons.AddRange(new[] {new EditorButton(ButtonPredefines.Combo)});
            calWorkMinute.Size = new Size(0x3a, 20);
            calWorkMinute.TabIndex = 7;
            calWorkMinute.Visible = false;
            labelControl18.Appearance.ForeColor = Color.Blue;
            labelControl18.Appearance.Options.UseForeColor = true;
            labelControl18.Location = new Point(0xf9, 470);
            labelControl18.Name = "labelControl18";
            labelControl18.Size = new Size(30, 13);
            labelControl18.TabIndex = 8;
            labelControl18.Text = "(ph\x00fat)";
            labelControl18.Visible = false;
            labelControl20.Appearance.ForeColor = Color.Blue;
            labelControl20.Appearance.Options.UseForeColor = true;
            labelControl20.Location = new Point(0xf9, 0x1ec);
            labelControl20.Name = "labelControl20";
            labelControl20.Size = new Size(30, 13);
            labelControl20.TabIndex = 11;
            labelControl20.Text = "(ph\x00fat)";
            labelControl20.Visible = false;
            bits = new int[4];
            calHalfWorkMinute.EditValue = new decimal(bits);
            calHalfWorkMinute.Location = new Point(0xbd, 0x1e9);
            calHalfWorkMinute.Name = "calHalfWorkMinute";
//            calHalfWorkMinute.Properties.Buttons.AddRange(new[] {new EditorButton(ButtonPredefines.Combo)});
            calHalfWorkMinute.Size = new Size(0x3a, 20);
            calHalfWorkMinute.TabIndex = 10;
            calHalfWorkMinute.Visible = false;
            labelControl21.AllowHtmlString = true;
            labelControl21.Location = new Point(15, 0x1ec);
            labelControl21.Name = "labelControl21";
            labelControl21.Size = new Size(0xa9, 14);
            labelControl21.TabIndex = 9;
            labelControl21.Text = "Từ bao nhi\x00eau ph\x00fat th\x00ec đủ <color=red><b>0.5</b></color> c\x00f4ng?";
            labelControl21.Visible = false;
            txtDescription.Location = new Point(0x3b, 0x19d);
            txtDescription.Name = "txtDescription";
            txtDescription.Size = new Size(0x23d, 40);
            txtDescription.TabIndex = 12;
            groupBox5.Controls.Add(cboMethodCheck);
            groupBox5.Location = new Point(7, 0x15b);
            groupBox5.Name = "groupBox5";
            groupBox5.Size = new Size(0x139, 0x3b);
            groupBox5.TabIndex = 14;
            groupBox5.TabStop = false;
            groupBox5.Text = "C\x00e1ch thức chấm c\x00f4ng";
            cboMethodCheck.EditValue = "Chấm 2 lần v\x00e0o l\x00fac v\x00e0o/l\x00fac ra";
            cboMethodCheck.Location = new Point(0x10, 0x1b);
            cboMethodCheck.Name = "cboMethodCheck";
//            cboMethodCheck.Properties.Buttons.AddRange(new[] {new EditorButton(ButtonPredefines.Combo)});
            cboMethodCheck.Properties.Items.AddRange(new object[]
            {
                "Chấm 1 lần v\x00e0o l\x00fac v\x00e0o", "Chấm 1 lần v\x00e0o l\x00fac ra",
                "Chấm 2 lần v\x00e0o l\x00fac v\x00e0o/l\x00fac ra"
            });
            cboMethodCheck.Properties.TextEditStyle = TextEditStyles.DisableTextEditor;
            cboMethodCheck.Size = new Size(0x11b, 20);
            cboMethodCheck.TabIndex = 0;
            cboMethodCheck.SelectedIndexChanged += cboMethodCheck_SelectedIndexChanged;
            gbAOT.Controls.Add(labelControl34);
            gbAOT.Controls.Add(lbMaximumMinuteAOT);
            gbAOT.Controls.Add(calMaximumMinuteAOT);
            gbAOT.Controls.Add(labelControl27);
            gbAOT.Controls.Add(labelControl26);
            gbAOT.Controls.Add(cheIsAOT);
            gbAOT.Controls.Add(lbDistanceMinuteAOT);
            gbAOT.Controls.Add(calDistanceMinuteAOT);
            gbAOT.Controls.Add(lbMinimumMinuteAOT);
            gbAOT.Controls.Add(calMinimumMinuteAOT);
            gbAOT.Location = new Point(0x145, 0x94);
            gbAOT.Name = "gbAOT";
            gbAOT.Size = new Size(0x133, 0x70);
            gbAOT.TabIndex = 15;
            gbAOT.TabStop = false;
            gbAOT.Text = "T\x00ednh tăng ca sau giờ l\x00e0m việc";
            labelControl34.Appearance.ForeColor = Color.Blue;
            labelControl34.Appearance.Options.UseForeColor = true;
            labelControl34.Location = new Point(0x102, 0x3b);
            labelControl34.Name = "labelControl34";
            labelControl34.Size = new Size(30, 13);
            labelControl34.TabIndex = 0x11;
            labelControl34.Text = "(ph\x00fat)";
            lbMaximumMinuteAOT.Location = new Point(13, 0x3b);
            lbMaximumMinuteAOT.Name = "lbMaximumMinuteAOT";
            lbMaximumMinuteAOT.Size = new Size(0xac, 13);
            lbMaximumMinuteAOT.TabIndex = 0x10;
            lbMaximumMinuteAOT.Text = "Số ph\x00fat tăng ca tối đa l\x00e0 bao nhi\x00eau?";
            bits = new int[4];
            bits[0] = 60;
            calMaximumMinuteAOT.EditValue = new decimal(bits);
            calMaximumMinuteAOT.Enabled = false;
            calMaximumMinuteAOT.Location = new Point(0xc3, 0x38);
            calMaximumMinuteAOT.Name = "calMaximumMinuteAOT";
//            calMaximumMinuteAOT.Properties.Buttons.AddRange(new[] {new EditorButton(ButtonPredefines.Combo)});
            calMaximumMinuteAOT.Size = new Size(0x3a, 20);
            calMaximumMinuteAOT.TabIndex = 15;
            labelControl27.Appearance.ForeColor = Color.Blue;
            labelControl27.Appearance.Options.UseForeColor = true;
            labelControl27.Location = new Point(0x101, 0x54);
            labelControl27.Name = "labelControl27";
            labelControl27.Size = new Size(30, 13);
            labelControl27.TabIndex = 14;
            labelControl27.Text = "(ph\x00fat)";
            labelControl26.Appearance.ForeColor = Color.Blue;
            labelControl26.Appearance.Options.UseForeColor = true;
            labelControl26.Location = new Point(0x103, 0x21);
            labelControl26.Name = "labelControl26";
            labelControl26.Size = new Size(30, 13);
            labelControl26.TabIndex = 13;
            labelControl26.Text = "(ph\x00fat)";
            cheIsAOT.Location = new Point(0xd5, -2);
            cheIsAOT.Name = "cheIsAOT";
            cheIsAOT.Properties.Caption = "";
            cheIsAOT.Size = new Size(0x15, 0x13);
            cheIsAOT.TabIndex = 12;
            cheIsAOT.CheckedChanged += cheIsAOT_CheckedChanged;
            lbDistanceMinuteAOT.Location = new Point(13, 0x54);
            lbDistanceMinuteAOT.Name = "lbDistanceMinuteAOT";
            lbDistanceMinuteAOT.Size = new Size(0xb1, 13);
            lbDistanceMinuteAOT.TabIndex = 11;
            lbDistanceMinuteAOT.Text = "C\x00e1ch giờ kết th\x00fac ca bao nhi\x00eau ph\x00fat?";
            bits = new int[4];
            bits[0] = 30;
            calDistanceMinuteAOT.EditValue = new decimal(bits);
            calDistanceMinuteAOT.Enabled = false;
            calDistanceMinuteAOT.Location = new Point(0xc3, 0x51);
            calDistanceMinuteAOT.Name = "calDistanceMinuteAOT";
//            calDistanceMinuteAOT.Properties.Buttons.AddRange(new[] {new EditorButton(ButtonPredefines.Combo)});
            calDistanceMinuteAOT.Size = new Size(0x3a, 20);
            calDistanceMinuteAOT.TabIndex = 10;
            lbMinimumMinuteAOT.Location = new Point(14, 0x21);
            lbMinimumMinuteAOT.Name = "lbMinimumMinuteAOT";
            lbMinimumMinuteAOT.Size = new Size(0xa9, 13);
            lbMinimumMinuteAOT.TabIndex = 9;
            lbMinimumMinuteAOT.Text = "Đủ bao nhi\x00eau ph\x00fat th\x00ec t\x00ednh tăng ca?";
            bits = new int[4];
            bits[0] = 60;
            calMinimumMinuteAOT.EditValue = new decimal(bits);
            calMinimumMinuteAOT.Enabled = false;
            calMinimumMinuteAOT.Location = new Point(0xc3, 30);
            calMinimumMinuteAOT.Name = "calMinimumMinuteAOT";
//            calMinimumMinuteAOT.Properties.Buttons.AddRange(new[] {new EditorButton(ButtonPredefines.Combo)});
            calMinimumMinuteAOT.Size = new Size(0x3a, 20);
            calMinimumMinuteAOT.TabIndex = 8;
            gbBOT.Controls.Add(labelControl32);
            gbBOT.Controls.Add(labelControl33);
            gbBOT.Controls.Add(calMaximumMinuteBOT);
            gbBOT.Controls.Add(labelControl28);
            gbBOT.Controls.Add(labelControl29);
            gbBOT.Controls.Add(cheIsBOT);
            gbBOT.Controls.Add(labelControl30);
            gbBOT.Controls.Add(calDistanceMinuteBOT);
            gbBOT.Controls.Add(labelControl31);
            gbBOT.Controls.Add(calMinimumMinuteBOT);
            gbBOT.Location = new Point(0x145, 0x20);
            gbBOT.Name = "gbBOT";
            gbBOT.Size = new Size(0x133, 110);
            gbBOT.TabIndex = 0x10;
            gbBOT.TabStop = false;
            gbBOT.Text = "T\x00ednh tăng ca trước giờ l\x00e0m việc";
            labelControl32.Appearance.ForeColor = Color.Blue;
            labelControl32.Appearance.Options.UseForeColor = true;
            labelControl32.Location = new Point(0x103, 0x36);
            labelControl32.Name = "labelControl32";
            labelControl32.Size = new Size(30, 13);
            labelControl32.TabIndex = 0x11;
            labelControl32.Text = "(ph\x00fat)";
            labelControl33.Location = new Point(14, 0x36);
            labelControl33.Name = "labelControl33";
            labelControl33.Size = new Size(0xac, 13);
            labelControl33.TabIndex = 0x10;
            labelControl33.Text = "Số ph\x00fat tăng ca tối đa l\x00e0 bao nhi\x00eau?";
            bits = new int[4];
            bits[0] = 60;
            calMaximumMinuteBOT.EditValue = new decimal(bits);
            calMaximumMinuteBOT.Enabled = false;
            calMaximumMinuteBOT.Location = new Point(0xc3, 0x33);
            calMaximumMinuteBOT.Name = "calMaximumMinuteBOT";
//            calMaximumMinuteBOT.Properties.Buttons.AddRange(new[] {new EditorButton(ButtonPredefines.Combo)});
            calMaximumMinuteBOT.Size = new Size(0x3a, 20);
            calMaximumMinuteBOT.TabIndex = 15;
            labelControl28.Appearance.ForeColor = Color.Blue;
            labelControl28.Appearance.Options.UseForeColor = true;
            labelControl28.Location = new Point(0x102, 0x4f);
            labelControl28.Name = "labelControl28";
            labelControl28.Size = new Size(30, 13);
            labelControl28.TabIndex = 14;
            labelControl28.Text = "(ph\x00fat)";
            labelControl29.Appearance.ForeColor = Color.Blue;
            labelControl29.Appearance.Options.UseForeColor = true;
            labelControl29.Location = new Point(0x103, 0x1d);
            labelControl29.Name = "labelControl29";
            labelControl29.Size = new Size(30, 13);
            labelControl29.TabIndex = 13;
            labelControl29.Text = "(ph\x00fat)";
            cheIsBOT.Location = new Point(0xd5, -3);
            cheIsBOT.Name = "cheIsBOT";
            cheIsBOT.Properties.Caption = "";
            cheIsBOT.Size = new Size(0x17, 0x13);
            cheIsBOT.TabIndex = 12;
            cheIsBOT.CheckedChanged += cheIsBOT_CheckedChanged;
            labelControl30.Location = new Point(14, 0x4f);
            labelControl30.Name = "labelControl30";
            labelControl30.Size = new Size(0xaf, 13);
            labelControl30.TabIndex = 11;
            labelControl30.Text = "C\x00e1ch giờ bắt đầu ca bao nhi\x00eau ph\x00fat?";
            bits = new int[4];
            bits[0] = 30;
            calDistanceMinuteBOT.EditValue = new decimal(bits);
            calDistanceMinuteBOT.Enabled = false;
            calDistanceMinuteBOT.Location = new Point(0xc3, 0x4c);
            calDistanceMinuteBOT.Name = "calDistanceMinuteBOT";
//            calDistanceMinuteBOT.Properties.Buttons.AddRange(new[] {new EditorButton(ButtonPredefines.Combo)});
            calDistanceMinuteBOT.Size = new Size(0x3a, 20);
            calDistanceMinuteBOT.TabIndex = 10;
            labelControl31.Location = new Point(14, 0x1d);
            labelControl31.Name = "labelControl31";
            labelControl31.Size = new Size(0xa9, 13);
            labelControl31.TabIndex = 9;
            labelControl31.Text = "Đủ bao nhi\x00eau ph\x00fat th\x00ec t\x00ednh tăng ca?";
            bits = new int[4];
            bits[0] = 60;
            calMinimumMinuteBOT.EditValue = new decimal(bits);
            calMinimumMinuteBOT.Enabled = false;
            calMinimumMinuteBOT.Location = new Point(0xc3, 0x1a);
            //calMinimumMinuteBOT.Name = "calMinimumMinuteBOT";
            //calMinimumMinuteBOT.Properties.Buttons.AddRange(new[] {new EditorButton(ButtonPredefines.Combo)});
            calMinimumMinuteBOT.Size = new Size(0x3a, 20);
            calMinimumMinuteBOT.TabIndex = 8;
            cheIsNightDutyDay.Location = new Point(0xfe, 30);
            cheIsNightDutyDay.Name = "cheIsNightDutyDay";
            cheIsNightDutyDay.Properties.Caption = "Trực đ\x00eam";
            cheIsNightDutyDay.Size = new Size(70, 0x13);
            cheIsNightDutyDay.TabIndex = 2;
            cheIsNightDutyDay.EditValueChanged += cheIsNightDay_EditValueChanged;
            cboWorkDay.EditValue = "1";
            cboWorkDay.Location = new Point(0xc1, 0x58);
            cboWorkDay.Name = "cboWorkDay";
            cboWorkDay.Properties.AllowNullInput = DefaultBoolean.False;
            cboWorkDay.Properties.Appearance.Options.UseTextOptions = true;
            cboWorkDay.Properties.Appearance.TextOptions.HAlignment = HorzAlignment.Far;
            cboWorkDay.Properties.AppearanceFocused.Options.UseTextOptions = true;
            cboWorkDay.Properties.AppearanceFocused.TextOptions.HAlignment = HorzAlignment.Far;
            cboWorkDay.Properties.Mask.IgnoreMaskBlank = false;
            cboWorkDay.Properties.Mask.MaskType = MaskType.Numeric;
            cboWorkDay.Properties.Mask.UseMaskAsDisplayFormat = true;
            cboWorkDay.Size = new Size(0x3a, 20);
            cboWorkDay.TabIndex = 13;
            base.AutoScaleDimensions = new SizeF(6f, 13f);
            //base.AutoScaleMode = AutoScaleMode.Font;
            base.Controls.Add(labelControl19);
            base.Controls.Add(calWorkMinute);
            base.Controls.Add(labelControl18);
            base.Controls.Add(labelControl20);
            base.Controls.Add(labelControl21);
            base.Controls.Add(calHalfWorkMinute);
            base.Name = "xucShiftAdd";
            base.Size = new Size(640, 0x200);
            base.Controls.SetChildIndex(calHalfWorkMinute, 0);
            base.Controls.SetChildIndex(labelControl21, 0);
            base.Controls.SetChildIndex(labelControl20, 0);
            base.Controls.SetChildIndex(labelControl18, 0);
            base.Controls.SetChildIndex(calWorkMinute, 0);
            base.Controls.SetChildIndex(labelControl19, 0);
            base.Controls.SetChildIndex(base.gcInfo, 0);
            base.Controls.SetChildIndex(base.btnCancel, 0);
            base.Controls.SetChildIndex(base.btnSave, 0);
            base.Controls.SetChildIndex(base.btnSaveNew, 0);
            base.gcInfo.EndInit();
            base.gcInfo.ResumeLayout(false);
            base.gcInfo.PerformLayout();
            base.txtNAME.Properties.EndInit();
            base.txtID.Properties.EndInit();
            base.imageCollection2.EndInit();
            ((ISupportInitialize) base.Err).EndInit();
            teBeginTime.Properties.EndInit();
            teEndTime.Properties.EndInit();
            groupBox1.ResumeLayout(false);
            groupBox1.PerformLayout();
            teEndTime2.Properties.EndInit();
            teEndTime1.Properties.EndInit();
            teBeginTime2.Properties.EndInit();
            teBeginTime1.Properties.EndInit();
            groupBox2.ResumeLayout(false);
            groupBox2.PerformLayout();
            calEarlyMinute.Properties.EndInit();
            calLateMinute.Properties.EndInit();
            cheIsOvernight.Properties.EndInit();
            groupBox3.ResumeLayout(false);
            groupBox3.PerformLayout();
            cheIsBreakOvernight.Properties.EndInit();
            cheIsBreak.Properties.EndInit();
            teBreakBeginTime.Properties.EndInit();
            teBreakEndTime.Properties.EndInit();
            groupBox4.ResumeLayout(false);
            groupBox4.PerformLayout();
            calTotalHour.Properties.EndInit();
            calTotalMinute.Properties.EndInit();
            calWorkMinute.Properties.EndInit();
            calHalfWorkMinute.Properties.EndInit();
            txtDescription.Properties.EndInit();
            groupBox5.ResumeLayout(false);
            cboMethodCheck.Properties.EndInit();
            gbAOT.ResumeLayout(false);
            gbAOT.PerformLayout();
            calMaximumMinuteAOT.Properties.EndInit();
            cheIsAOT.Properties.EndInit();
            calDistanceMinuteAOT.Properties.EndInit();
            calMinimumMinuteAOT.Properties.EndInit();
            gbBOT.ResumeLayout(false);
            gbBOT.PerformLayout();
            calMaximumMinuteBOT.Properties.EndInit();
            cheIsBOT.Properties.EndInit();
            calDistanceMinuteBOT.Properties.EndInit();
            calMinimumMinuteBOT.Properties.EndInit();
            cheIsNightDutyDay.Properties.EndInit();
            cboWorkDay.Properties.EndInit();
            base.ResumeLayout(false);
            base.PerformLayout();
        }

        private void RaiseSuccessEventHander(DIC_SHIFT item)
        {
            if (Success != null)
            {
                Success(this, item);
            }
        }

        public void SetData(DIC_SHIFT item)
        {
            base.txtID.Text = item.ShiftCode;
            SYS_LOG.Insert("Danh Mục Ca L\x00e0m Việc", "Xem", base.txtID.Text);
            if (base.m_Status == Common.Class.Actions.Update)
            {
                base.txtID.Properties.ReadOnly = true;
            }
            base.txtNAME.Text = item.ShiftName;
            teBeginTime.Time = item.BeginTime;
            teEndTime.Time = item.EndTime;
            cheIsOvernight.Checked = item.IsOvernight;
            teBeginTime1.Time = item.BeginTime1;
            teBeginTime2.Time = item.BeginTime2;
            teEndTime1.Time = item.EndTime1;
            teEndTime2.Time = item.EndTime2;
            calLateMinute.EditValue = item.LateMinute;
            calEarlyMinute.EditValue = item.EarlyMinute;
            cheIsBreak.Checked = item.IsBreak;
            cheIsBreakOvernight.Checked = item.IsBreakOvernight;
            teBreakBeginTime.Time = item.BreakBeginTime;
            teBreakEndTime.Time = item.BreakEndTime;
            calTotalMinute.EditValue = item.TotalMinute;
            calTotalHour.EditValue = item.TotalHour;
            calWorkMinute.EditValue = item.WorkMinute;
            calHalfWorkMinute.EditValue = item.HalfWorkMinute;
            cboWorkDay.EditValue = item.WorkDay;
            cboMethodCheck.SelectedIndex = item.MethodCheck;
            cheIsBOT.Checked = item.IsBOT;
            cheIsAOT.Checked = item.IsAOT;
            calMinimumMinuteBOT.EditValue = item.MinimumMinuteBOT;
            calMaximumMinuteBOT.EditValue = item.MaximumMinuteBOT;
            calDistanceMinuteBOT.EditValue = item.DistanceMinuteBOT;
            calMinimumMinuteAOT.EditValue = item.MinimumMinuteAOT;
            calMaximumMinuteAOT.EditValue = item.MaximumMinuteAOT;
            calDistanceMinuteAOT.EditValue = item.DistanceMinuteAOT;
            cheIsNightDutyDay.EditValue = item.IsNightDutyDay;
            txtDescription.Text = item.Description;
        }

        private void teBeginTime_EditValueChanged(object sender, EventArgs e)
        {
            teBeginTime1.EditValue = DateAndTime.DateAdd(DateInterval.Hour, -1.0,
                DateTime.Parse(teBeginTime.EditValue.ToString()));
            teEndTime1.EditValue = DateTime.Parse(teBeginTime.EditValue.ToString());
            CalculatorMinute();
        }

        private void teBreakBeginTime_EditValueChanged(object sender, EventArgs e)
        {
            CalculatorMinute();
        }

        private void teEndTime_EditValueChanged(object sender, EventArgs e)
        {
            teBeginTime2.EditValue = DateTime.Parse(teEndTime.EditValue.ToString());
            teEndTime2.EditValue = DateAndTime.DateAdd(DateInterval.Hour, 1.0,
                DateTime.Parse(teEndTime.EditValue.ToString()));
            CalculatorMinute();
        }

        protected override void txtID_EditValueChanged(object sender, EventArgs e)
        {
            var control = (TextEdit) sender;
            if (control.ErrorText != string.Empty)
            {
                base.Err.SetError(control, string.Empty);
            }
            if (base.m_Status == Actions.Add)
            {
                var dic_shift = new DIC_SHIFT();
                if (dic_shift.Exist(control.Text))
                {
                    base.Err.SetError(control, "M\x00e3 đ\x00e3 tồn tại.");
                    control.Focus();
                }
            }
        }

        protected override void txtID_KeyDown(object sender, KeyEventArgs e)
        {
            var control = (TextEdit) sender;
            if ((e.KeyCode == Keys.Enter) | (e.KeyCode == Keys.Tab))
            {
                var dic_shift = new DIC_SHIFT();
                if ((base.m_Status == Actions.Add) && dic_shift.Exist(control.Text))
                {
                    base.Err.SetError(control, "M\x00e3 đ\x00e3 tồn tại.");
                    control.Focus();
                }
            }
        }

        protected override string uc_Change()
        {
            return string.Empty;
        }

        protected override string uc_Delete()
        {
            var item = new DIC_SHIFT
            {
                ShiftCode = base.txtID.Text
            };
            string str = item.Delete();
            if (str == "OK")
            {
                RaiseSuccessEventHander(item);
            }
            return str;
        }

        protected override string uc_Save()
        {
            if (MyRule.Get(MyLogin.RoleId, "bbiShift") != "OK")
            {
                return "";
            }
            if (!MyRule.AllowAdd)
            {
                MyRule.Notify();
                return "";
            }
            SYS_LOG.Insert("Danh Mục Ca L\x00e0m Việc", "Th\x00eam", base.txtID.Text);
            base.SetWaitDialogCaption("Đang lưu dữ liệu...");
            Cursor.Current = Cursors.WaitCursor;
            var item = new DIC_SHIFT(base.txtID.Text, base.txtNAME.Text, Convert.ToDateTime(teBeginTime.Time),
                Convert.ToDateTime(teEndTime.Time), cheIsOvernight.Checked, Convert.ToDateTime(teBeginTime1.Time),
                Convert.ToDateTime(teBeginTime2.Time), Convert.ToDateTime(teEndTime1.Time),
                Convert.ToDateTime(teEndTime2.Time), Convert.ToInt32(calLateMinute.EditValue.ToString()),
                Convert.ToInt32(calEarlyMinute.EditValue.ToString()), cheIsBreak.Checked, cheIsBreakOvernight.Checked,
                Convert.ToDateTime(teBreakBeginTime.Time), Convert.ToDateTime(teBreakEndTime.Time),
                Convert.ToInt32(calTotalMinute.EditValue.ToString()),
                Convert.ToDouble(calTotalHour.EditValue.ToString()),
                Convert.ToInt32(calHalfWorkMinute.EditValue.ToString()),
                Convert.ToInt32(calWorkMinute.EditValue.ToString()), Convert.ToDouble(cboWorkDay.EditValue.ToString()),
                cboMethodCheck.SelectedIndex, cheIsBOT.Checked, cheIsAOT.Checked,
                Convert.ToInt32(calMinimumMinuteBOT.EditValue.ToString()),
                Convert.ToInt32(calMaximumMinuteBOT.EditValue.ToString()),
                Convert.ToInt32(calDistanceMinuteBOT.EditValue.ToString()),
                Convert.ToInt32(calMinimumMinuteAOT.EditValue.ToString()),
                Convert.ToInt32(calMaximumMinuteAOT.EditValue.ToString()),
                Convert.ToInt32(calDistanceMinuteAOT.EditValue.ToString()), cheIsNightDutyDay.Checked,
                txtDescription.Text);
            string text = item.Insert();
            if (text == "OK")
            {
                RaiseSuccessEventHander(item);
            }
            Cursor.Current = Cursors.Default;
            this.DoHide();
            if (text != "OK")
            {
                XtraMessageBox.Show(text, "Cảnh B\x00e1o", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            return text;
        }

        protected override string uc_Update()
        {
            if (MyRule.Get(MyLogin.RoleId, "bbiShift") != "OK")
            {
                return "";
            }
            if (!MyRule.AllowEdit)
            {
                MyRule.Notify();
                return "";
            }
            SYS_LOG.Insert("Danh Mục Ca L\x00e0m Việc", "Cập Nhật", base.txtID.Text);
            base.SetWaitDialogCaption("Đang cập nhật dữ liệu...");
            var item = new DIC_SHIFT(base.txtID.Text, base.txtNAME.Text, Convert.ToDateTime(teBeginTime.Time),
                Convert.ToDateTime(teEndTime.Time), cheIsOvernight.Checked, Convert.ToDateTime(teBeginTime1.Time),
                Convert.ToDateTime(teBeginTime2.Time), Convert.ToDateTime(teEndTime1.Time),
                Convert.ToDateTime(teEndTime2.Time), Convert.ToInt32(calLateMinute.EditValue.ToString()),
                Convert.ToInt32(calEarlyMinute.EditValue.ToString()), cheIsBreak.Checked, cheIsBreakOvernight.Checked,
                Convert.ToDateTime(teBreakBeginTime.Time), Convert.ToDateTime(teBreakEndTime.Time),
                Convert.ToInt32(calTotalMinute.EditValue.ToString()),
                Convert.ToDouble(calTotalHour.EditValue.ToString()),
                Convert.ToInt32(calHalfWorkMinute.EditValue.ToString()),
                Convert.ToInt32(calWorkMinute.EditValue.ToString()), Convert.ToDouble(cboWorkDay.EditValue.ToString()),
                cboMethodCheck.SelectedIndex, cheIsBOT.Checked, cheIsAOT.Checked,
                Convert.ToInt32(calMinimumMinuteBOT.EditValue.ToString()),
                Convert.ToInt32(calMaximumMinuteBOT.EditValue.ToString()),
                Convert.ToInt32(calDistanceMinuteBOT.EditValue.ToString()),
                Convert.ToInt32(calMinimumMinuteAOT.EditValue.ToString()),
                Convert.ToInt32(calMaximumMinuteAOT.EditValue.ToString()),
                Convert.ToInt32(calDistanceMinuteAOT.EditValue.ToString()), cheIsNightDutyDay.Checked,
                txtDescription.Text);
            string text = item.Update();
            if (text == "OK")
            {
                RaiseSuccessEventHander(item);
            }
            if (text != "OK")
            {
                XtraMessageBox.Show(text, "Cảnh B\x00e1o", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            this.DoHide();
            return text;
        }
    }
}